package pratima.thread;

public class MyThread extends Thread {
	
	//info:
	/*Thread is for building concurrency
	High level of concurreny is not good
	Best way of resolving high level of concurrency is by
	 having threads in controlled fashion*/
	
	/*Thread share parent space i.e Java space*/
	
	/*Synchronize z for locking the resources*/
	
	private volatile int vid;
	
	//Each thread will have its own local localId attribute when we use ThreadLocal
		ThreadLocal<Integer> localId = new ThreadLocal<Integer>();
	
	private int id;
	
	public MyThread(int id2) {
		id = id2;
	}
	@Override
	public void run() {
		for (int i=0; i<10 ;i++) {
			System.out.println("Thread Runnable "+ id + " printing: "+i);
			
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

}
